/**
 * 2022.08.10每日一题 力扣1413:逐步求和得到正数的最小值
 */


class Solution13 {
    public static void main(String[] args) {
        int[] num = {1,2,3,4,5,6};
        minStartValue(num);
    }
    public static int minStartValue(int[] nums) {
        int min = 0;
        int sum = 0;
        for(int i = 0 ; i < nums.length ; i++){
            sum += nums[i];
            min = Math.min(min , sum);
        }
        return Math.abs(min) + 1;
    }
}